package de.westranger.forex.trading.genetic.allel.operator;

import java.text.ParseException;

public enum TerminalSymbol {
	HIGH(0),
	LOW(1),	
	ASK(2),
	BID(3),
	OPEN(4),
	CLOSE(5),
	TIME(6),

	EMA3(7),
	EMA6(8),
	EMA9(9),
	EMA12(10),
	EMA15(11),
	EMA18(12),
	EMA21(13),
	EMA24(14),
	EMA27(15),
	EMA30(16),
	EMA33(17),
	EMA36(18),
	EMA39(19),
	EMA42(20),
	EMA45(21),
	EMA48(22),
	EMA51(23),
	EMA54(24),
	EMA57(25),
	EMA60(26),

	SMA3(27),
	SMA6(28),
	SMA9(29),
	SMA12(30),
	SMA15(31),
	SMA18(32),
	SMA21(33),
	SMA24(34),
	SMA27(35),
	SMA30(36),
	SMA33(37),
	SMA36(38),
	SMA39(39),
	SMA42(40),
	SMA45(41),
	SMA48(42),
	SMA51(43),
	SMA54(44),
	SMA57(45),
	SMA60(46),
	

	// for testcases only
	DO_NOT_USE_ME(666);

	private final int value;

	private TerminalSymbol(final int value) {
		this.value = value;
	}

	public final int getValue() {
		return this.value;
	}

	public static final TerminalSymbol parse(final int value) throws ParseException {
		TerminalSymbol termSym;
		switch (value) {
		case 0:
			termSym = TerminalSymbol.HIGH;
			break;
		case 1:
			termSym = TerminalSymbol.LOW;
			break;
		case 2:
			termSym = TerminalSymbol.ASK;
			break;
		case 3:
			termSym = TerminalSymbol.BID;
			break;
		case 4:
			termSym = TerminalSymbol.OPEN;
			break;
		case 5:
			termSym = TerminalSymbol.CLOSE;
			break;
		case 6:
			termSym = TerminalSymbol.TIME;
			break;
		case 7:
			termSym = TerminalSymbol.EMA3;
			break;
		case 8:
			termSym = TerminalSymbol.EMA6;
			break;			
		case 9:
			termSym = TerminalSymbol.EMA9;
			break;
		case 10:
			termSym = TerminalSymbol.EMA12;
			break;			
		case 11:
			termSym = TerminalSymbol.EMA15;
			break;
		case 12:
			termSym = TerminalSymbol.EMA18;
			break;
		case 13:
			termSym = TerminalSymbol.EMA21;
			break;
		case 14:
			termSym = TerminalSymbol.EMA24;
			break;
		case 15:
			termSym = TerminalSymbol.EMA27;
			break;
		case 16:
			termSym = TerminalSymbol.EMA30;
			break;			
		case 17:
			termSym = TerminalSymbol.EMA33;
			break;
		case 18:
			termSym = TerminalSymbol.EMA36;
			break;		
		case 19:
			termSym = TerminalSymbol.EMA39;
			break;
		case 20:
			termSym = TerminalSymbol.EMA42;
			break;
		case 21:
			termSym = TerminalSymbol.EMA45;
			break;			
		case 22:
			termSym = TerminalSymbol.EMA48;
			break;			
		case 23:
			termSym = TerminalSymbol.EMA51;
			break;
		case 24:
			termSym = TerminalSymbol.EMA54;
			break;
		case 25:
			termSym = TerminalSymbol.EMA57;
			break;			
		case 26:
			termSym = TerminalSymbol.EMA60;
			break;
		case 27:
			termSym = TerminalSymbol.EMA3;
			break;
		case 28:
			termSym = TerminalSymbol.EMA6;
			break;			
		case 29:
			termSym = TerminalSymbol.EMA9;
			break;
		case 30:
			termSym = TerminalSymbol.EMA12;
			break;			
		case 31:
			termSym = TerminalSymbol.EMA15;
			break;
		case 32:
			termSym = TerminalSymbol.EMA18;
			break;
		case 33:
			termSym = TerminalSymbol.EMA21;
			break;
		case 34:
			termSym = TerminalSymbol.EMA24;
			break;
		case 35:
			termSym = TerminalSymbol.EMA27;
			break;
		case 36:
			termSym = TerminalSymbol.EMA30;
			break;			
		case 37:
			termSym = TerminalSymbol.EMA33;
			break;
		case 38:
			termSym = TerminalSymbol.EMA36;
			break;		
		case 39:
			termSym = TerminalSymbol.EMA39;
			break;
		case 40:
			termSym = TerminalSymbol.EMA42;
			break;
		case 41:
			termSym = TerminalSymbol.EMA45;
			break;			
		case 42:
			termSym = TerminalSymbol.EMA48;
			break;			
		case 43:
			termSym = TerminalSymbol.EMA51;
			break;
		case 44:
			termSym = TerminalSymbol.EMA54;
			break;
		case 45:
			termSym = TerminalSymbol.EMA57;
			break;			
		case 46:
			termSym = TerminalSymbol.EMA60;
			break;
		case 666:
			termSym = TerminalSymbol.DO_NOT_USE_ME;
			break;
		default:
			throw new ParseException(
					"could not parse TerminalSymbol with the value " + value, 0);
		}
		return termSym;
	}
}
